package com.disedu.testdl123.adapter;

import java.util.List;


import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class HomeGridAdapter extends BaseAdapter {
	private Context context;
	private List<Bitmap> bitmaps ;
	
	public HomeGridAdapter(Context context,List<Bitmap> bitmaps) {
		this.context = context;
		this.bitmaps = bitmaps ;
	}
	

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return bitmaps.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView iv = null ;
		// TODO Auto-generated method stub
		if(convertView == null ){
			iv = new ImageView(context ) ;
		}else {
			iv = (ImageView) convertView ;
		}
		iv.setImageBitmap(bitmaps.get(position)) ;
		return iv ;
	}
}
